package com.my.blog.website.controller;

import com.my.blog.website.modal.Vo.RechargeRecordVo;
import com.my.blog.website.service.IRechargeRecordService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

/**
 * @author ：gyh
 * @date ：Created in 2020/10/11 2:06
 * @description：用户购买毕设控制器
 * @modified By：gyh
 * @version: 1.0
 */
@Controller
@RequestMapping("/recharge")
public class RechargeRecordController extends BaseController {

    @Resource
    private IRechargeRecordService rechargeRecordService;

    /**
     * 扫描支付页面(当面付)
     *
     * @return
     */
    @GetMapping("/dmf")
    public String dmf() {
        return this.render("alipay/dmf");
    }


    /**
     * 支付成功页面
     *
     * @return
     */
    @GetMapping("/paysuccess/{outTradeNo}")
    public String paysuccess(@PathVariable String outTradeNo, HttpServletRequest request) {
        RechargeRecordVo rechargeRecord = rechargeRecordService.getById(outTradeNo);
        request.setAttribute("rechargeRecord", rechargeRecord);
        return this.render("alipay/success");
    }


}
